<html>
<head><meta charset="utf-8"><title>Multi-workspace support · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html">Multi-workspace support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181313025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181313025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181313025">(Nov 21 2019 at 15:09)</a>:</h4>
<p>I'm trying to dig into <a href="https://github.com/rust-analyzer/rust-analyzer/issues/2202" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2202">https://github.com/rust-analyzer/rust-analyzer/issues/2202</a> a little bit</p>



<a name="181313101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181313101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181313101">(Nov 21 2019 at 15:10)</a>:</h4>
<p>but adding <code>println!()</code> calls in the ra_lsp_server don't show up anywhere as far as I can see</p>



<a name="181313121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181313121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181313121">(Nov 21 2019 at 15:10)</a>:</h4>
<p>neither do <code>log::error!()</code> messages</p>



<a name="181313134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181313134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181313134">(Nov 21 2019 at 15:10)</a>:</h4>
<p>any hint on how I could debug this thing?</p>



<a name="181313593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181313593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181313593">(Nov 21 2019 at 15:14)</a>:</h4>
<p>You can try <a href="https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/dev#logging" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/dev#logging">https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/dev#logging</a></p>



<a name="181314221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181314221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181314221">(Nov 21 2019 at 15:20)</a>:</h4>
<p>even when running <code>env RUST_LOG=gen_lsp_server=trace</code>, I don't see anything show up in the "Rust Analyzer Language Server Trace" tab</p>



<a name="181315161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181315161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181315161">(Nov 21 2019 at 15:28)</a>:</h4>
<p>Did you check the box in the vscode settings?</p>



<a name="181315235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181315235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181315235">(Nov 21 2019 at 15:29)</a>:</h4>
<p>Sorry.... not a box. It's a trace option</p>



<a name="181315269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181315269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181315269">(Nov 21 2019 at 15:29)</a>:</h4>
<p>I did now and there is some output</p>



<a name="181315289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181315289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181315289">(Nov 21 2019 at 15:29)</a>:</h4>
<p>but not anything I log or print from inside the server, as far as I can tell</p>



<a name="181315627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181315627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181315627">(Nov 21 2019 at 15:32)</a>:</h4>
<p>It might be<code> ra_lsp_server</code> instead of <code>gen_lsp_server</code> now</p>



<a name="181316049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181316049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181316049">(Nov 21 2019 at 15:36)</a>:</h4>
<p>sounds sensible, but I don't see it making a difference</p>



<a name="181316612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181316612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181316612">(Nov 21 2019 at 15:42)</a>:</h4>
<p>ahhh, found it</p>



<a name="181316867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181316867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181316867">(Nov 21 2019 at 15:45)</a>:</h4>
<p>?</p>



<a name="181317742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181317742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181317742">(Nov 21 2019 at 15:53)</a>:</h4>
<p>there was a different tab called "Rust Analyzer Language Server"</p>



<a name="181328827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181328827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181328827">(Nov 21 2019 at 17:47)</a>:</h4>
<p>Acutally I wanted to show you the <code>RA_LOG_DIR</code>, but I should have said that, sorry</p>



<a name="181328840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181328840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181328840">(Nov 21 2019 at 17:47)</a>:</h4>
<p>Glad you got it working though</p>



<a name="181577110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181577110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181577110">(Nov 21 2019 at 19:45)</a>:</h4>
<p>Yeah, there are two tabs, one for client-side tracing of requests, on for server-side logging</p>



<a name="181577155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181577155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181577155">(Nov 21 2019 at 19:45)</a>:</h4>
<p>note that we use stdout to communicate with the client, so println breaks things at the root</p>



<a name="181577171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181577171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181577171">(Nov 21 2019 at 19:45)</a>:</h4>
<p>eprintln should be fine</p>



<a name="181581682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181581682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181581682">(Nov 21 2019 at 20:37)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> the <code>WorldState</code> seems to be aware of all my workspaces just fine</p>



<a name="181581776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181581776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181581776">(Nov 21 2019 at 20:38)</a>:</h4>
<p>but somehow compilation feedback only shows up for the first one in the list (which happens to also be the <code>rootPath</code>, although it seems that ends up not being used if multiple workspaces are defined)</p>



<a name="181581785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181581785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dirkjan Ochtman <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181581785">(Nov 21 2019 at 20:38)</a>:</h4>
<p>any thoughts on where I should look next?</p>



<a name="181586851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181586851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthias247 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181586851">(Nov 21 2019 at 21:36)</a>:</h4>
<blockquote>
<p>note that we use stdout to communicate with the client, so println breaks things at the root</p>
</blockquote>
<p>FWIW: This cost me about an hour to find out why nothing worked anymore after I tried to debug my RA changes. I had no idea it could have been related to the debug statements I added. Maybe some notification could emitted to prevent that. E.g. if VsCode detects malformed LSP requests, it shows up popup/notification or emits something in the extension log that says "Do not use <code>println!</code> for debugging. If you don't and still get this error, file a bug report".</p>



<a name="181615588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181615588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181615588">(Nov 22 2019 at 07:27)</a>:</h4>
<p><span class="user-mention" data-user-id="226095">@Dirkjan Ochtman</span> interesting. The next thing to look at would probably be <code>FileLoaderDelegate::relevant_crates</code> -- this function should return a list of crates (compilation units), that can contain the given file. If that <em>also</em> returns a non-empty result, then the best thing to do would probably be to try to create a minimal reproduction, as I don't think there are more places where we can bisect the logic.</p>



<a name="181615664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181615664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181615664">(Nov 22 2019 at 07:28)</a>:</h4>
<p><span class="user-mention" data-user-id="204219">@Matthias247</span> ah, we actually even <strong>lock</strong> stdout in the server, so <code>println</code>s just deadlock. Let's just override println in the server lib...</p>



<a name="181615859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181615859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181615859">(Nov 22 2019 at 07:34)</a>:</h4>
<p><span class="user-mention" data-user-id="204219">@Matthias247</span> <a href="https://github.com/rust-analyzer/rust-analyzer/pull/2349" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/2349">https://github.com/rust-analyzer/rust-analyzer/pull/2349</a> should help in the future!</p>



<a name="181616145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181616145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthias247 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181616145">(Nov 22 2019 at 07:41)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204219">Matthias247</span> <a href="https://github.com/rust-analyzer/rust-analyzer/pull/2349" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/2349">https://github.com/rust-analyzer/rust-analyzer/pull/2349</a> should help in the future!</p>
</blockquote>
<p>Does that help if you use <code>println!</code> in any of the other rust-analyzer crates? Like I tried in <code>ra-project-model</code>?</p>



<a name="181616240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace%20support/near/181616240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Multi-workspace.20support.html#181616240">(Nov 22 2019 at 07:43)</a>:</h4>
<p><span class="user-mention" data-user-id="204219">@Matthias247</span> nope, it doesn't :(</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>